package org.onion.pattern.sample.active.listener;

import lombok.extern.slf4j.Slf4j;
import org.onion.pattern.event.springboot.rocketmq.annotation.RocketMQConsumerGroup;
import org.onion.pattern.event.springboot.rocketmq.annotation.RocketMQEventListener;
import org.onion.pattern.event.springboot.rocketmq.annotation.enums.ListenerMode;
import org.onion.pattern.event.springboot.rocketmq.config.RocketMessageMetadata;
import org.onion.pattern.event.springboot.rocketmq.consume.RocketMQContextHolder;
import org.onion.pattern.sample.active.service.event.MRocketMQMessaageSub;
import org.springframework.stereotype.Component;


@Component
@RocketMQConsumerGroup(value = "MRocketMQMessaageListener", listenerMode = ListenerMode.Orderly)
@Slf4j
public class MRocketMQMessaageListener {

    @RocketMQEventListener
    public void on(MRocketMQMessaageSub event) {
        RocketMessageMetadata metadata = RocketMQContextHolder.getMetadata();
        //父类也能收到消息
        log.info("【收到消息】  MRocketMQMessaageSub  {} metadata {}",event,metadata);
    }



}
